From c2c102907073dbdd468e72e58dd4bc855a404e65 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Tue, 23 Sep 2008 17:11:33 +0100 Subject: [PATCH] hvm, save/restore: Skip page batches which contain no valid pages. Signed-off-by: Keir Fraser --- tools/libxc/xc_domain_save.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c index c6e1c23c32..c1ced27d98 100644 --- a/tools/libxc/xc_domain_save.c +++ b/tools/libxc/xc_domain_save.c @@ -1115,7 +1115,20 @@ int xc_domain_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters, goto out; } - if ( !hvm ) + if ( hvm ) + { + /* Look for and skip completely empty batches. */ + for ( j = 0; j < batch; j++ ) + if ( (pfn_type[j] & XEN_DOMCTL_PFINFO_LTAB_MASK) != + XEN_DOMCTL_PFINFO_XTAB ) + break; + if ( j == batch ) + { + munmap(region_base, batch*PAGE_SIZE); + continue; /* bail on this batch: no valid pages */ + } + } + else { /* Get page types */ for ( j = 0; j < batch; j++ ) -- 2.30.2